﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class user_private : Wozuji.Logic.PageLogin
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.Header.Title = "足迹网 用户隐私设置";
        
        if (!IsPostBack)
        {
            Wozuji.Model.Member_t mb = new Wozuji.Model.Member_t();
            Wozuji.BLL.Member_t mbbll = new Wozuji.BLL.Member_t();
            mb = mbbll.GetModel(Convert.ToInt32(Session["userid"]));
            if (mb.Member_private.Equals("0"))
            {
                open.Checked = true;
                smallopen.Checked = false;
                notopen.Checked = false;
            }
            else if(mb.Member_private.Equals("1"))
            {
            open.Checked=false;
                smallopen.Checked = true;
                notopen.Checked = false;
            }
            else if(mb.Member_private.Equals("2"))
            {
                open.Checked=false;
                smallopen.Checked = false;
                notopen.Checked = true;
            }
        }
    }
    protected void open_CheckedChanged(object sender, EventArgs e)
    {
        if (open.Checked)
        {
            smallopen.Checked = false;
            notopen.Checked = false;
        }

    }
    protected void smallopen_CheckedChanged(object sender, EventArgs e)
    {
        open.Checked = false;
        notopen.Checked = false;
    }

    protected void notopen_CheckedChanged(object sender, EventArgs e)
    {
        smallopen.Checked = false;
        open.Checked = false;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (smallopen.Checked || open.Checked || notopen.Checked)
        {
            
            savemsg.Text = "";
            string svalue="";
            if(open.Checked)
            {
                svalue="0";
            }
            if(smallopen.Checked)
            {
                svalue="1";
            }
            if(notopen.Checked)
            {
                svalue="2";
            }
            Wozuji.Model.Member_t mb = new Wozuji.Model.Member_t();
            Wozuji.BLL.Member_t mbbll = new Wozuji.BLL.Member_t();
            mb = mbbll.GetModel(Convert.ToInt32(Session["userid"]));
            mb.Member_private = svalue;
            mbbll.Update(mb);
            savemsg.Text = "保存成功!";
        }
        else
        {
            savemsg.Text = "请至少选择一项！";
        }
    }
}
